<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>主生产计划列表</title>
    <script>
        $(function () {
            var pageNumber=2;
            var thispages=1;
            scjhmxListPage(pageNumber,thispages);
            $("#likeSelect").click(function () {
                LikescjhListPage(pageNumber,thispages);
            });
            //时间模板
            layui.use('laydate', function() {
                var laydate = layui.laydate;

                //日期时间选择器
                laydate.render({
                    elem: "#scgl_scjhmx_startDate"

                });
                laydate.render({
                    elem: "#scgl_scjhmx_overDate"

                });

            });
            $("#scgl_scjh_orderadd").click(function () {
                //跳转到添加页面
                location.href ="/#/page/scgl/scgl_scjh_orderadd_html.html"
            });
        });
        //一进页面就异步查询
        function scjhmxListPage(pageNumber,thispages){
            $.get("/scgl_scjhmxselectAll_limit?pageN="+pageNumber+"&thispageN="+thispages,null,
                function (data) {
                console.log(data);
                    $("#scgl_scjhList_secondtable").html("");
                    for(var i=0;i<data.scglScjhmxes.length;i++) {
                        var html="<tr>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxItemnum+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxItemname+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxSpecifications+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxUnit+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxDemandnum+"</td>\n";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxStartdate+"</td>\n";
                            html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxOverdate+"</td>\n" +
                            "</tr>";
                        $("#scgl_scjhList_secondtable").append(html)
                    }
                    page(data.thispageN,data.allpage,data.pageN);
                });
        }
       // 模糊查询
        function LikescjhListPage(pageNumber,thispages){
            var scgl_scjhmx_itemName=$("#scgl_scjhmx_itemName").val();
            var scgl_scjhmx_startDate=$("#scgl_scjhmx_startDate").val();
            var scgl_scjhmx_overDate=$("#scgl_scjhmx_overDate").val();
            $.get("/scgl_LikescjhmxselectAll_limit?pageN="+pageNumber+"&thispageN="+thispages
                +"&scgl_scjhmx_itemName="+scgl_scjhmx_itemName
                +"&scgl_scjhmx_startDate="+scgl_scjhmx_startDate
                +"&scgl_scjhmx_overDate="+scgl_scjhmx_overDate
                , null,
                function (data) {
                    console.log(data);
                    $("#scgl_scjhList_secondtable").html("");
                    for(var i=0;i<data.scglScjhmxes.length;i++) {
                        var html="<tr>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxItemnum+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxItemname+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxSpecifications+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxUnit+"</td>\n" +
                            "            <td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxDemandnum+"</td>\n";
                        html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxStartdate+"</td>\n";
                        html+="<td class=\"scgl_scjhList_firsttable01_tr_td\">"+data.scglScjhmxes[i].scglScjhmxOverdate+"</td>\n" +
                            "</tr>";
                        $("#scgl_scjhList_secondtable").append(html)
                    }
                    page1(data.thispageN,data.allpage,data.pageN);
                });
        }
        //页码函数
        function page(thispage,allpage,pageNu) {
            $("#pageli").html("");
            $("#pageli").append("<li class=\"li112\" id=\"firPage\">首页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"upPage\">上一页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"thisP\">"+thispage+"</li>");
            $("#pageli").append("<li class=\"li112\" id=\"nextPage\">下一页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"lastPage\">共"+allpage+"页</li>");
            $("#pageli").append("<li class=\"li112\">到第<input type=\"text\" style=\"width: 30px\" id=\"tiao\" value=\""+thispage+"\" onmouseover=\"this.select()\" />页</li>");
            $("#pageli").append("<li class=\"li112\"><input type=\"button\" value=\"确认\" id=\"queren\" style=\"font-size: 13px;color: #444444;\"/></li>");

            //首页的点击事件
            $("#firPage").click(function() {
                thispages=1;
                scjhmxListPage(pageNu,thispages);
            });
            //上一页点击事件
            $("#upPage").click(function() {
                if(thispage>1){
                    thispage=thispage-1;
                    scjhmxListPage(pageNu,thispage);
                }
            });
            //下一页点击事件
            $("#nextPage").click(function() {
                if(thispage<allpage){
                    thispage=thispage+1;
                    scjhmxListPage(pageNu,thispage);
                }
            });
            //确认的点击事件
            $("#queren").click(function() {
                if($("#tiao").val()<=allpage&&$("#tiao").val()>0){
                    thispage=$("#tiao").val()
                    scjhmxListPage(pageNu,thispage);
                }
                if($("#tiao").val()>allpage){
                    thispage=allpage;
                    $("#tiao").val(allpage);
                    scjhmxListPage(pageNu,thispage);
                }
            });
        }
        //模糊页码函数
        function page1(thispage,allpage,pageNu) {
            $("#pageli").html("");
            $("#pageli").append("<li class=\"li112\" id=\"firPage\">首页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"upPage\">上一页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"thisP\">"+thispage+"</li>");
            $("#pageli").append("<li class=\"li112\" id=\"nextPage\">下一页</li>");
            $("#pageli").append("<li class=\"li112\" id=\"lastPage\">共"+allpage+"页</li>");
            $("#pageli").append("<li class=\"li112\">到第<input type=\"text\" style=\"width: 30px\" id=\"tiao\" value=\""+thispage+"\" onmouseover=\"this.select()\" />页</li>");
            $("#pageli").append("<li class=\"li112\"><input type=\"button\" value=\"确认\" id=\"queren\" style=\"font-size: 13px;color: #444444;\"/></li>");

            //首页的点击事件
            $("#firPage").click(function() {
                thispages=1;
                LikescjhListPage(pageNu,thispages);
            });
            //上一页点击事件
            $("#upPage").click(function() {
                if(thispage>1){
                    thispage=thispage-1;
                    LikescjhListPage(pageNu,thispage);
                }
            });
            //下一页点击事件
            $("#nextPage").click(function() {
                if(thispage<allpage){
                    thispage=thispage+1;
                    LikescjhListPage(pageNu,thispage);
                }
            });
            //确认的点击事件
            $("#queren").click(function() {
                if($("#tiao").val()<=allpage&&$("#tiao").val()>0){
                    thispage=$("#tiao").val()
                    LikescjhListPage(pageNu,thispage);
                }
                if($("#tiao").val()>allpage){
                    thispage=allpage;
                    $("#tiao").val(allpage);
                    LikescjhListPage(pageNu,thispage);
                }
            });
        }


    </script>
    <style>
        .li112{
            float:left;
            margin-left:14px;
            font-size: 16px;
            cursor:pointer;
        }
        .scgl_scjhList_firsttable {
            width: 100%;
            height: 30px;
            border:slategray 2px solid ;
            text-align: center;
        }

        .scgl_scjhList_firsttable tr {
            border-bottom: 2px solid slategray;
        }
        .scgl_scjhList_firsttable_tr_td {
            background-color: #FFFFF0;
            border-right: 2px solid slategray;
            width: 10%;
            height: 30px;
        }
        .scgl_scjhList_firsttable01_tr_td {
            border-right: 2px solid slategray;
            width: 10%;
            height: 30px;
        }
        .scgl_scjhList_secondtable {
            text-align: center;
            width: 100%;
            height: 30px;
            border:slategray 2px solid ;
        }
    </style>
</head>
<body>
<!--页面主题-->
<div style="height: 50px;width: 100%; font-weight: bold;text-align: center;font-size: 30px">生产订单列表</div>

<fieldset class="table-search-fieldset">
    <legend>搜索信息</legend>
    <div style="margin: 10px 10px 10px 10px">
        <form class="layui-form layui-form-pane" >
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">物品名称</label>
                    <div class="layui-input-inline">
                        <input type="text" id="scgl_scjhmx_itemName" name="scgl_scjhmx_itemName" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">开工日期</label>
                    <div class="layui-input-inline">
                        <input  type="text" id="scgl_scjhmx_startDate" name="scgl_scjhmx_startDate" class="layui-input"/>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">完工日期</label>
                    <div class="layui-input-inline">
                        <input   type="text" id="scgl_scjhmx_overDate"  name="scgl_scjhmx_overDate" class="layui-input"/>
                    </div>
                <div class="layui-inline">
                    <button type="button" id="likeSelect" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                </div>
            </div>
        </form>
    </div>
</fieldset>
<div style="margin-top: 20px">
<button  type="button" id="scgl_scjh_orderadd" class="layui-btn layui-btn-normal layui-btn-radius">添加</button>
</div>
<!--/页面主题-->
<!--详细展示-->
<div class="scgl_scjhList_firstdiv"  style="width: 100%;height: 500px;">
    <table class="scgl_scjhList_firsttable" cellpadding="0px" cellspacing="0px" border="2px">
        <tr>
            <td class="scgl_scjhList_firsttable_tr_td">物品编号</td>
            <td class="scgl_scjhList_firsttable_tr_td">物品名称</td>
            <td class="scgl_scjhList_firsttable_tr_td">规格</td>
            <td class="scgl_scjhList_firsttable_tr_td">基本单位</td>
            <td class="scgl_scjhList_firsttable_tr_td">需求数量</td>
            <td class="scgl_scjhList_firsttable_tr_td">计划开工日期</td>
            <td class="scgl_scjhList_firsttable_tr_td">计划完工日期</td>

        </tr>
    </table>

    <table id="scgl_scjhList_secondtable"  class="scgl_scjhList_secondtable" cellpadding="0px" cellspacing="0px" border="2px">

    </table>
    <div class='pages_bar' style="margin-left:400px;margin-top: 20px">
        <ul id="pageli"></ul>
    </div>
</div>
</body>
</html>